<template>
  <div>
    <div v-if="album.length != 0">
      <ImageWaterfall :data-source="album" style="height: 800px"/>
    </div>

    <div v-else>
      <EmptyTip />
    </div>

  </div>
</template>

<script>
  import ImageWaterfall from "../../../components/public/ImageWaterfall";
  import {request} from "../../../util/network/request";
  import {USER_GET_ALBUM} from "../../../util/network/api/user/api-user";
  import eventBus from "../../../util/bus/eventBus";
  import EmptyTip from "../../../components/public/EmptyTip";

  export default {
    name: "MyAlbum",
    components: {EmptyTip, ImageWaterfall},
    data(){
      return {
        uid: this.$route.params.uid,
        album: [],
      }
    },

    created() {
      this.getAlbum(this.uid);
    },

    mounted() {

    },

    methods: {

      //获取相册图片
      getAlbum(uid) {
        request({
          url: USER_GET_ALBUM + uid,
          method: 'get',
        }).then(res => {
          // console.log(res);
          res.data.data.map(item => {
            let temp = {};
            temp.src = item;
            temp.href = "";
            this.album.push(temp);
          });
        }).catch(err => {
          console.log(err)
        })
      },
    }
  }
</script>

<style scoped>

</style>
